package com.huhao.concurrency.example.mq.kafka;

import com.huhao.concurrency.example.mq.Message;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Description KafkaSender发送端
 * @Author 胡浩
 * @Date 2020/6/1
 **/
@Component
@Slf4j
public class KafkaSender {

//    @Resource
//    private KafkaTemplate<String, String> kafkaTemplate;
//    private Gson gson = new GsonBuilder().create();
//
//    public void send(String msg) {
//        Message message = new Message();
//        message.setId(System.currentTimeMillis());
//        message.setMsg(msg);
//        message.setSendTime(new Date());
//        log.info("send message:{}", message);
//        kafkaTemplate.send(TopicConstants.TEST, gson.toJson(message));
//    }

}
